import org.joda.time.*
import java.text.SimpleDateFormat
import java.sql.Timestamp

class DateFormatCodec {

    static SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy")
    static encode = {date ->
        if (date instanceof java.util.Date)
            return format.format(date)
        else if (date instanceof java.sql.Timestamp)
            return format.format(new Date(((Timestamp) date).getTime()))
        else
            return ""
    }
}